woogc/global_cart/sites
Name: woogc/global_cart/sites
Type: Filter
Arguments: (array) $sites_ids
The following code snippet demonstrates how to synchronize the current shop with only the designated checkout site. This selective synchronization is particularly useful when you want to minimize the number of shops involved in the network, ensuring that only the current site and the checkout site are synced. This approach optimizes performance and reduces unnecessary data transfer, focusing the synchronization process on the essential sites only.
By utilizing the woogc/global_cart/sites
filter, you can easily define which sites within the network should be included in the global cart synchronization, providing flexibility and control over your multisite setup.
add_filter('woogc/global_cart/sites', 'woogc_global_cart_sites'); function woogc_global_cart_sites( $sites ) { $options = WooGC_Functions::get_options(); if ( $options['synchronization_type'] != 'screen' ) return $sites; if ( $options['cart_checkout_location'] < 1 ) return $sites; global $blog_id; $sites = array(); if ( $blog_id != $options['cart_checkout_location'] ) $sites = array ( $options['cart_checkout_location'] ); return $sites; }
The code should be placed inside a php file on wp-content/mu-plugins folder.